package cn.itsource.org.domain;
import cn.itsource.basic.domain.BaseTreeNode;
import cn.itsource.basic.domain.baseDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_department")
@ApiModel(value = "部门实体类")
public class Department extends BaseTreeNode<Department> {
    /**
     * 编号
     */
    @Size(min=3,max = 6,message = "请输入3-6之间的部门编号")
    @NotBlank(message = "不能为空")
    @ApiModelProperty(value = "部门编号")
    private String sn;
    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称")
    private String name;
    /**
     * 状态
     */
    @ApiModelProperty(value = "状态")
    private Integer state;
    /**
     * 管理员id
     */
    @ApiModelProperty(value = "管理员id")
    private Long managerId;
    /**
     * 父id
     */
    private Long parentId;
    /**
     * 路径 。先不管
     */
    private String dirPath;
    /**
     * 部门经理
     */
    @Transient //不参与字段的crud
    private Employee manager;
    /**
     * 上级部门
     */
    @Transient //不参与字段的crud
    private Department parent;

    @Transient
    private Long[] managerIds;
}
